﻿@namespace BlazorFluentUI
@using Microsoft.AspNetCore.Components.Web;
@typeparam T

@if (ItemTemplate == null)
{
    <button @onclick="ButtonClicked" class="ms-ContextualMenu-link mediumFont">@Content</button>
}
else
{
    <button @onclick="ButtonClicked" style=" outline: transparent; position: relative; color: var(--semanticTextColors-BodyText); background-color: transparent; border: none; width: 100%; display: block; cursor: pointer; padding: 0 8px 0 4px; text-align: left;">
        @ItemTemplate(Content)
    </button>
}


@code {
    [Parameter] public T? Content { get; set; }
    [Parameter] public EventCallback<SearchItem<T>> Clicked { get; set; }
    [Parameter] public RenderFragment<T?>? ItemTemplate { get; set; }

    private void ButtonClicked(MouseEventArgs e)
    {
        Clicked.InvokeAsync(this);
    }
}
